using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Summary description for XL_Gio_hang
/// </summary>
public class XL_Gio_hang: DataTable
{
	public XL_Gio_hang()
	{
		//
		// TODO: Add constructor logic here
		//

        //Constructor
        DataColumn colMs = this.Columns.Add("ID", Type.GetType("System.Int32"));
        colMs.AutoIncrement = true;
        colMs.AutoIncrementStep = 1;
        colMs.AutoIncrementSeed = 1;
        this.Columns.Add("STT", Type.GetType("System.Int32"));
        this.Columns.Add("ID_SP", Type.GetType("System.Int32"));
        this.Columns.Add("ID_nhom_SP", Type.GetType("System.Int32"));
        this.Columns.Add("Ten_SP", Type.GetType("System.String"));
        this.Columns.Add("hinh_anh", Type.GetType("System.String"));
        this.Columns.Add("so_Size", Type.GetType("System.String"));
        this.Columns.Add("gioi_tinh_sp", Type.GetType("System.String"));
        this.Columns.Add("id_gt", Type.GetType("System.Int32"));
        this.Columns.Add("So_Luong", Type.GetType("System.Int32"));
        this.Columns.Add("Gia_SP", Type.GetType("System.Single"));
        this.Columns.Add("Thanh_tien", Type.GetType("System.Double"), "So_luong*Gia_SP");
        this.Columns.Add("Tong_SL", Type.GetType("System.Double"), "So_luong*1");
        this.PrimaryKey = new DataColumn[] { colMs };


        //DataColumn colMs = this.Columns.Add("ID_SP", Type.GetType("System.Int32"));
        //this.Columns.Add("Ten_SP", Type.GetType("System.String"));
        //this.Columns.Add("Size", Type.GetType("System.String"));
        //this.Columns.Add("So_Luong", Type.GetType("System.Int32"));
        //this.Columns.Add("Gia_SP", Type.GetType("System.Single")); 
        //this.Columns.Add("Thanh_tien", Type.GetType("System.Double"),"So_luong*Gia_SP");
        //this.Columns.Add("Tong_SL", Type.GetType("System.Double"), "So_luong*1");
        //this.PrimaryKey = new DataColumn[] { colMs };
        
        

	}
    //Property

    public int Tong_so_mat_hang
    {
        get
        {
            return this.Rows.Count;
        }
    }
    public double Tong_tri_SoLuong
    {
        get
        {
            double kq = 0;
            object tong = this.Compute("Sum(Tong_SL)","");
            if (!(tong is DBNull))
            {
                kq = (double)tong;
            }
            return kq;
        }
    }
    public double Tong_tri_gia
    {
        get
        {
            double kq = 0;
            object tong = this.Compute("Sum(Thanh_tien)", "");
            if (!(tong is DBNull))
            {
                kq = (double)tong;
            }
            return kq;
        }
    }
}
